#pragma once
#include "PEInfo.h"
#include <list>

namespace CoreInterface
{
	public ref class PEAnalyzer sealed
	{
	public:
		
	private:
		static PEInfo^ Analyze32(unsigned char* pData, uint64 uDataSize);
		static PEInfo^ Analyze64(unsigned char* pData, uint64 uDataSize);

		static void ImageDosHeaderCopy(ImageDosHeader^ pImage, IMAGE_DOS_HEADER& dosHeader);

		static void ImageNtHeaders32Copy(ImageNtHeaders^ pImage, IMAGE_NT_HEADERS32& ntHeaders);
		static void ImageNtHeaders64Copy(ImageNtHeaders^ pImage, IMAGE_NT_HEADERS64& ntHeaders);

		static void ImageFileHeaderCopy(CoreInterface::ImageFileHeader^ pImage, IMAGE_FILE_HEADER& fileHeader);

		static void ImageOptionalHeader32Copy(ImageOptionalHeader^ pImage, IMAGE_OPTIONAL_HEADER32& optionalHeaders);
		static void ImageOptionalHeader64Copy(ImageOptionalHeader^ pImage, IMAGE_OPTIONAL_HEADER64& optionalHeaders);

		static void SectionHeaderCopy(ImageSectionHeader^ pImage, IMAGE_SECTION_HEADER& sectionHeader);

		static void ImportTableAnalyze32(std::list<ImportTableItem^>& ImportTable, PEInfo^ pPEInfo, unsigned char* pData);
		static void ImportTableAnalyze64(std::list<ImportTableItem^>& ImportTable, PEInfo^ pPEInfo, unsigned char* pData);

		static void ExportTableAnalyze(ExportFuncInfo^ ExportTable, PEInfo^ pPEInfo, unsigned char* pData);

		static Platform::String^ MultiByteToString(const char* pStr, int cb = -1);
	public:

		static Platform::String^ GetMachinInfo(PEInfo^ pPeInfo);
		static Platform::String^ GetCharacteristics(PEInfo^ pPeInfo);
		static Platform::String^ GetSubSystem(PEInfo^ pPeInfo);
		static PEInfo^ Analyze(Windows::Storage::StorageFile^ pFile);
		static Platform::String^ Test() { return ref new Platform::String(L"Hello World!"); }
	};
}
